From fe0dadb2288a1b5fbf418c08de83ba57861a4885 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Florian=20M=C3=BCllner?= Date: Tue, 28 Apr 2026 14:25:44 +0200 Subject: [PATCH] workspaceAnimation: Sort existing records when restacking When restacking, we currently re-filter window actors, then match each to the corresponding record. Instead, sort the existing records according to the new stacking, then iterate over those directly. This reflects more directly that window records are fixed during the transition, and avoids a (harmless) warning in case a window only appeared during the animation and therefore cannot be matched to a record. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/work_items/8881 Part-of: (cherry picked from commit e7e6de300cfb87c0f91738861b545017e5290ef9) --- js/ui/workspaceAnimation.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/js/ui/workspaceAnimation.js b/js/ui/workspaceAnimation.js index f7c2f7a3b..844bac451 100644 --- a/js/ui/workspaceAnimation.js +++ b/js/ui/workspaceAnimation.js @@ -123,15 +123,20 @@ class WorkspaceGroup extends BaseWorkspaceGroup { } _syncStacking() { - const windowActors = global.get_window_actors().filter(w => - this._shouldShowWindow(w.meta_window)); + const stackIndeces = new Map( + global.get_window_actors().map((w, i) => [w, i])); + + this._windowRecords.sort((a, b) => { + const seqA = a.windowActor; + const seqB = b.windowActor; + + return stackIndeces.get(seqA) - stackIndeces.get(seqB); + }); let lastRecord; const bottomActor = this._background ?? null; - for (const windowActor of windowActors) { - const record = this._windowRecords.find(r => r.windowActor === windowActor); - + for (const record of this._windowRecords) { this.set_child_above_sibling(record.clone, lastRecord ? lastRecord.clone : bottomActor); lastRecord = record; -- 2.39.5